package com.bw.unit3.base

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.ViewModel
import androidx.lifecycle.ViewModelProvider
import com.alibaba.android.arouter.launcher.ARouter
import java.lang.reflect.ParameterizedType

/**
 *
 * @ClassName: BaseActivity
 * @Description: java类作用描述
 * @Author: zhangyanchao
 * @CreateDate: 2024/9/13 10:54 AM
 * @Version: 1.0
 */
abstract class BaseDataBindingActivity< D : ViewDataBinding>(private val layoutId: Int) :
    AppCompatActivity() {
    protected lateinit var dataBinding: D
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        dataBinding = DataBindingUtil.setContentView(this, layoutId)
        dataBinding.lifecycleOwner = this


        initView()
//        initData()

    }

//    abstract fun initData()

    abstract fun initView()


    override fun onDestroy() {
        super.onDestroy()
        if (dataBinding != null) {
            dataBinding.unbind()
        }
    }
}